package com.toKnow.mapper;

import com.toKnow.model.dto.SearchDto;
import com.toKnow.model.entity.*;

import java.util.List;

public interface SourceMapper {
    public Source selectById(Integer id);
    public Boolean updateLikeNumber(Integer id,Integer num);
    public Boolean updateCollectNumber(Integer id,Integer num);
    public Boolean updateBuyNumber(Integer id,Integer num);
    public Boolean updateDownloadNumber(Integer id,Integer num);
    public Boolean insertUserLike(Integer userId,Integer sourceId);
    public Boolean insertUserCollect(Integer userId,Integer sourceId);
    public Boolean insertUserBuy(Integer userId,Integer sourceId,Double price);
    public Boolean insertUserDownload(Integer userId,Integer sourceId);
    public Boolean deleteUserLike(Integer userId,Integer sourceId);
    public Boolean deleteUserCollect(Integer userId,Integer sourceId);
//    public Boolean deleteUserRead(Integer userId,Integer sourceId);
    public Boolean checkUserLike(Integer userId,Integer sourceId);
    public Boolean checkUserCollect(Integer userId,Integer sourceId);
    public Boolean checkUserDownload(Integer userId,Integer sourceId);
    public Boolean checkUserBuy(Integer userId,Integer sourceId);
    public Boolean updateUserDownload(Integer userId,Integer sourceId);
    public List<Type> selectTypeById(Integer sourceId);
    public List<Tag> selectTagById(Integer sourceId);
    public List<Source> selectSourceBySearch(SearchDto searchDto);
    public List<Source> selectSourceByAuthor(Integer userId,Integer startRow);
    public List<Source> selectSourceByBrowseHistory(Integer userId,Integer startRow);
    public List<SourceComment> selectSourceCommentBySourceId(Integer sourceId, Integer startRow);
    public List<SourceAnswer> selectSourceAnswerByCommentId(Integer commentId, Integer startRow);

    public List<Source> getDraftSource(Integer uid);
    public List<Source> getCheckingSource(Integer uid);
    public Source selectSourceDraftById(Integer uid, Integer sid);
    public List<Type> selectDraftTypeById(Integer id);
    public List<Tag> selectDraftTagById(Integer id);
}
